﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<nelech.Models.DBModel.Advert>>" %>
<% 
    if (Model == null)
    {
%>
<h2>
    נלך - טיולים באווירה יהודית
</h2>
<h3>
    לפרסום: 050-8421043
</h3>
<%
    }
    else
    {
        int id = (int)ViewData["Id"];
        foreach (var item in Model)
        {
            var advertImg = System.IO.Path.GetFileName(item.image.Replace("\\", "/"));
            var ext = System.IO.Path.GetExtension(advertImg);
            if (ext.Equals(".swf", StringComparison.OrdinalIgnoreCase))
            {


                string height = nelech.Views.Shared.Code.Utils.AdvertHeight(id);
                string width = nelech.Views.Shared.Code.Utils.AdvertWidth(id);        
%>
<object codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
    classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="<%= width %>" height="<%= height %>">
    <param name="_cx" value="19261">
    <param name="_cy" value="3968">
    <param name="FlashVars" value="">
    <param name="Movie" value="<%= advertImg %>">
    <param name="Src" value="">
    <param name="WMode" value="Window">
    <param name="Play" value="-1">
    <param name="Loop" value="-1">
    <param name="Quality" value="High">
    <param name="SAlign" value="">
    <param name="Menu" value="-1">
    <param name="Base" value="">
    <param name="AllowScriptAccess" value="never">
    <param name="Scale" value="ShowAll">
    <param name="DeviceFont" value="0">
    <param name="EmbedMovie" value="0">
    <param name="BGColor" value="">
    <param name="SWRemote" value="">
    <param name="MovieData" value="">
    <param name="SeamlessTabbing" value="1">
    <param name="Profile" value="0">
    <param name="ProfileAddress" value="">
    <param name="ProfilePort" value="0">
    <param name="AllowNetworking" value="all">
    <param name="AllowFullScreen" value="false">
    <embed src='<%= advertImg %>' quality="high" wmode='opaque' width='<%= width %>'
        height='<%= height %>' type='application/x-shockwave-flash' pluginspace='http://www.adobe.com/go/getflashplayer'
        allowscriptaccess='never' flashvars=""></embed>
</object>
<%
    }
               else
               {
                  if (!string.IsNullOrEmpty(item.link))
                {


                    Response.Write("<a href=\"" + item.link + "\" target='_blank'><img class=\"advert\" src=\"/Advert/" + advertImg + "\" alt=\"" + item.name + "\" /></a>");
                }
                else
                {
                    if (!string.IsNullOrEmpty(item.pdf))
                    {
                        Response.Write("<a href=\"http://nelech.co.il/" + item.pdf + "\" target='_blank'><img class=\"advert\" src=\"/Advert/" + advertImg + "\" alt=\"" + item.name + "\" /></a>");
                   
                    }
                    else
                    {

                        Response.Write("<a href=\"http://nelech.co.il/" + item.bigImg + "\" target='_blank'><img class=\"advert\" src=\"/Advert/" + advertImg + "\" alt=\"" + item.name + "\" /></a>");
                    }
               }
           }
       }
%>
